<?php 

$content = $_POST['content'];
$ip = time();
session_start(); 
if ($_POST['clear']==1) {
	$_SESSION = array();
}
$_SESSION['chat'][$ip]=$content;
$chat = isset($_SESSION['data'])?$_SESSION['data']:'';
foreach ($_SESSION['chat'] as $key => $value) {
	$chat.="<div class='".$key."'>".$value."</div>";
}
$_SESSION['data'] = $chat;
echo $chat;